﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JSIF_WCFServer.Model;
using System.ServiceModel;

namespace JSIF_WCFServer.Server
{
    /// <summary>
    /// A service which allows a client to read a book, or fetch information about it
    /// </summary>
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, AddressFilterMode = AddressFilterMode.Any)]
    public class BookshelfReaderImpl : IBookshelfReader
    {
        /// <summary>
        /// Returns a list of the books visible to the user on this server
        /// </summary>
        /// <returns>a list of the books visible to the user on this server</returns>
        public List<Book> ListStories()
        {
            List<Book> result = new List<Book>();
            result.Add(new Book() { Title = "Foo" });
            result.Add(new Book() { Title = "Bar" });
            return result;
        }

        /// <summary>
        /// Returns the history of changes made to the book visible to the user
        /// </summary>
        /// <param name="shortname">The server specific shortname of the book</param>
        /// <returns>the history of changes made to the book visible to the user</returns>
        public List<HistoryItem> GetHistoryForBook(string shortname)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Returns the version of the book which is playable online (or a media file if specified)
        /// </summary>
        /// <param name="shortname">The server specific shortname of the book</param>
        /// <param name="fileRef">An optional reference to a specific media file, if no file is specified this should return the root html file for the story</param>
        /// <returns>the version of the book which is playable online (or a media file if specified)</returns>
        public System.IO.Stream GetPublishedOnlineVersion(string shortname, string fileRef)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Returns the version of the book which is playable offline
        /// </summary>
        /// <param name="shortname">The server specific shortname of the book</param>
        /// <returns>the version of the book which is playable offline</returns>
        public System.IO.Stream GetPublishedOffineVersion(string shortname)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Returns a zip archive of the book with the current version and all media files included
        /// </summary>
        /// <remarks>
        /// You would use this version of the book to export the book to another server
        /// </remarks>
        /// <param name="shortname">The server specific shortname of the book</param>
        /// <returns>a zip archive of the book with the current version and all media files included</returns>
        public System.IO.Stream GetPublishedArchiveVersion(string shortname)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Returns the meta data for a book
        /// </summary>
        /// <param name="shortname">The server specific shortname of the book</param>
        /// <returns>the meta data for a book</returns>
        public Book GetBookInfo(string shortname)
        {
            throw new NotImplementedException();
        }        
    }
}
